package cn.project.lemontree.service.impl;

import cn.project.lemontree.bean.Class;
import cn.project.lemontree.service.ClassService;
import cn.project.lemontree.dao.ClassDao;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ClassServiceImpl extends ServiceImpl<ClassDao,Class> implements ClassService {
    @Resource
    private ClassDao classDao;
    @Override
    public List<Class> listpage(int page, int size, String className, String teacherName) {
        return classDao.listPage((page-1)*size, size, className, teacherName);
    }

    @Override
    public int count(String className, String teacherName) {
        return classDao.count(className, teacherName);
    }

    @Override
    public boolean saveClass(Class aclass) {
        return classDao.save(aclass)>0;
    }

    @Override
    public boolean updateClass(Class aclass) {
        return classDao.update(aclass)>0;
    }

    @Override
    public boolean setInvitationCode(Integer classId) {
        return classDao.setInvitationCode(classId)>0;
    }

    @Override
    public Class findClassByid(Integer teacherId){
        return classDao.findClassByid(teacherId);
    }

    @Override
    public Class getClassdetails(Integer childId){
        return classDao.getClassdetails(childId);
    }

    @Override
    public List<Class> getAllClass(){
        return classDao.getAllClass();
    }

    @Override
    public boolean countChild() {
        return classDao.countChild()>0;
    }

    @Override
    public List<Class> findEmptyClass() {
        return classDao.findEmptyClass();
    }
}
